package com.fh.service.wechat;

import com.fh.Enum.WeChatFinalValue;
import com.fh.util.HttpClientUtil;
import com.fh.util.JsonUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * Created by Administrator on 2017/8/21.
 */
@Component("weChatAccService")
public class WeChatAccService {
    public String appId = "wx49b6fdc3cd55a1f7";
    public String secret = "02a1a568c931a8fc582ca67e065bc0ee";

    public Map getSessionKey(Map map){
        String js_code = (String) map.get("js_code");
        String url = WeChatFinalValue.GETSESSIONKEY.getValue().replaceAll("APPID",appId).replaceAll("SECRET",secret).replaceAll("JSCODE",js_code);
        String result = HttpClientUtil.doPost(url);
        return JsonUtil.toObject(result,Map.class);
    }
}

